import React from 'react';

interface BrowserViewProps {
  url: string;
  isLoading?: boolean;
  className?: string;
}

export function BrowserView({ url, isLoading, className = '' }: BrowserViewProps) {
  return (
    <div className={`w-full h-full bg-white ${className}`}>
      {isLoading && (
        <div className="absolute inset-0 flex items-center justify-center bg-white bg-opacity-80">
          <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"></div>
        </div>
      )}
      <webview 
        src={url}
        className="w-full h-full"
        // @ts-ignore - webview 类型定义
        allowpopups
        webpreferences="contextIsolation=no"
      />
    </div>
  );
}